﻿using HeerCards;
using HeerCards.Helper;
using Native.Sdk.Cqp.EventArgs;
using System.Text;

namespace Code.Events
{
    public class ME_info : IMessageEvent
    {
        public string Message => "自定义抽卡 查看信息";

        string infoMessage =
            "=======自定义抽卡========\n" +
            "版本：{version}\n" +
            "授权状态：{ispro}\n" +
            "作者：{author}\n" +
            "卡池数量：{poolnumber}\n" +
            "货币单元数量：{costitemnumber}\n" +
            "=======自定义抽卡========";
        public void Process(CQPrivateMessageEventArgs e)
        {

        }
        public void Process(CQGroupMessageEventArgs e)
        {
            var info = infoMessage = infoMessage
                .Replace("{version}", AppMain.Version)
                .Replace("{ispro}", AppMain.VipInfo.VIPName)
                .Replace("{author}", "赫尔_Heer")
                .Replace("{poolnumber}", AppMain.Pools.Count.ToString())
                .Replace("{costitemnumber}", AppMain.CostUnits.Count.ToString());
            e.FromGroup.SendGroupMessage(info);
        }

    }
    public class ME_reload : IMessageEvent
    {
        public string Message => "自定义抽卡 重载";

        public void Process(CQPrivateMessageEventArgs e)
        {

        }

        public void Process(CQGroupMessageEventArgs e)
        {
            if (e.FromQQ.GetGroupMemberInfo(e.FromGroup).MemberType == Native.Sdk.Cqp.Enum.QQGroupMemberType.Member)
                return;

            AppReloader.LoadPools();
            AppReloader.LoadVIP();
            AppReloader.LoadGobal();
            AppReloader.LoadCosts();
            AppReloader.LoadImageDLC();

            e.FromGroup.SendGroupMessage("重载完成\n");
        }

    }
    public class ME_help : IMessageEvent
    {
        public string Message => "自定义抽卡 帮助";

        public void Process(CQPrivateMessageEventArgs e)
        {

        }

        public void Process(CQGroupMessageEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            AppMain.Pools.ForEach((HCPool item) => {
                string ten = (item.TenMessage == "") ? "无" : item.TenMessage; 
                sb.AppendLine(
                item.PoolName + " => 命令：" + item.Message+" 十连命令："+  ten
                );});
            string infoMessage =
                "=======自定义抽卡========\n" +
                "有趣小功能：" +
                "测测欧气 => 测试自己今天的欧气如何\n"+
                "欧皇排行榜 => 开发中\n" +
                "签到命令："+AppMain.commandHelper.CheckinCommand+"\n"+
                "背包命令:"+AppMain.commandHelper.BagCommand+"\n"+
                "前缀：自定义抽卡\n" +
                "-------帮助 => 查看抽卡命令帮助菜单\n" +
                "-------重载 => (仅限群主/管理员)重载卡池\n" +
                "-------查看信息 => 查看关于自定义抽卡插件的信息\n" +
                "卡池命令(无前缀)：\n" +
                sb.ToString() +
                "=======自定义抽卡========";
            e.FromGroup.SendGroupMessage(infoMessage);
        }

    }
}

